package org.dei.perla.parser.grammar.context;

import java.util.ArrayList;
import org.dei.perla.parser.expressions.ConstantString;
import org.dei.perla.parser.grammar.Token;
import org.dei.perla.parser.util.PairValue;

public class StatementForContext {
	
	
	
	/**
	 * Lista di coppie di valori (ConstantString, ConstantString) associati all'active if
	 */
	public static ArrayList<PairValue<ConstantString, ConstantString>> dimValueList = null;
	
	/**
	 * Token dello Statement corrente
	 */
	public static Token currentStatementToken = null;
	
	
	/**
	 * Reset del contesto
	 */
	public static void clear() {
		dimValueList = null;
		currentStatementToken = null;
	}
	

	
	/**
	 * Aggiunta della coppia dimensione valore come ConstantString alla clausola active if
	 * @param dimt token della dimensione
	 * @param valuet token del valore
	 */
	public static void addDimValue(Token dimt, Token valuet) {
		ConstantString dim = new ConstantString(dimt.image);
		ConstantString value = new ConstantString(valuet.image);
		if(dimValueList == null) {
			
			dimValueList = new ArrayList<PairValue<ConstantString, ConstantString>>();
		}
			
		PairValue<ConstantString, ConstantString> dimValue = new PairValue<ConstantString, ConstantString>();
		dimValue.setFirst(dim);
		dimValue.setSecond(value);
		dimValueList.add(dimValue);
	}
}
